package com.copera.cn.kaka;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TabHost;

import com.copera.cn.kaka.util.ActivityManager;

/**
 * 
 * @Description:首页
 *
 * 
 *
 * 
 */
@SuppressWarnings("deprecation")
public class TableHost2Activity extends TabActivity {

	private TabHost tabHost;
	private ApplicationCustomer appc;
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		ActivityManager.getInstance().push(this);
		setContentView(R.layout.tablehost2);

		tabHost = this.getTabHost();
		appc=(ApplicationCustomer)getApplication();
		appc.close();
		appc.addActivity(this);
		Intent intent = new Intent(this, MipcaActivityCapture.class);
		;
		Bundle bundle = new Bundle();
		bundle.putString("type", "rule");
		intent.putExtras(bundle);
		tabHost.addTab(tabHost
				.newTabSpec("卡点兑换")
				.setIndicator("卡点兑换")
				.setContent(
						new Intent(intent)
								.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));

		tabHost.setCurrentTab(2);

		RadioGroup radioGroup = (RadioGroup) this
				.findViewById(R.id.main_tab_group);
		radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(RadioGroup group, int checkedId) {
				switch (checkedId) {
				case R.id.main_tab_shop:
					tabHost.setCurrentTabByTag("我的店铺");
					Intent intent = new Intent(TableHost2Activity.this,TableHostActivity.class);
					startActivity(intent);
					overridePendingTransition(0,1);
					finish();
					break;
				case R.id.main_tab_track:
					tabHost.setCurrentTabByTag("记录足迹");
					 intent = new Intent(TableHost2Activity.this,TableHost1Activity.class);
					startActivity(intent);
					overridePendingTransition(0,1);
					finish();
					break;
				
				default:
					tabHost.setCurrentTabByTag("卡点兑换");
					break;
				}
			}
		});
	}
}
